Skip to content

Finish Position-Related Renamings #5697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 77 commits into from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jan 11, 2019

This is a follow-up to #5644, with more renamings from SourcePosition and its derivatives to Position. Hence, Position is now what it is in scalac: an aggregate of a source file and an offset interval (called a span here).

Compared to #5644, this PR changes fewer lines overall since some usages of pos, Position are kept, but now have a new meaning that the source is included.

So it might be easier to review only this PR instead of reviewing #5644 separately.

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Commit Messages

We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).

Please stick to these guidelines for commit messages:

  1. Separate subject from body with a blank line
  2. When fixing an issue, start your commit message with Fix #<ISSUE-NBR>:
  3. Limit the subject line to 72 characters
  4. Capitalize the subject line
  5. Do not end the subject line with a period
  6. Use the imperative mood in the subject line ("Add" instead of "Added")
  7. Wrap the body at 80 characters
  8. Use the body to explain what and why vs. how

adapted from https://chris.beams.io/posts/git-commit

Have an awesome day! ☀️

@odersky
Copy link
Contributor Author

odersky commented Jan 12, 2019

test performance please

@dottybot
Copy link
Member

performance test scheduled: 1 job(s) in queue, 0 running.

@dottybot
Copy link
Member

Performance test finished successfully:

Visit http://dotty-bench.epfl.ch/5697/ to see the changes.

Benchmarks is based on merging with master (00bfbbd)

@odersky
Copy link
Contributor Author

odersky commented Jan 12, 2019

We still have a slight performance degradation, but the fact is that we do solve a more complex problem now. I propose to ignore this for now, and do a more sweeping simplification of positions based on implicit parameters in another PR. That will hopefully improve performance.

... preparing to add a nextTreeId as well.
This removes some technical debt: nextId was a global counter, so
unreliable under parallelism. That was OK so far since it was only
intended for debugging. But now we want to give more significance to
tree ids, since they will be used to determine the source file of
a tree. Hence, we need to put this aspect in order by making nextTreeId
a context field. This entailed a lot of changes, so no wonder it was
not done before.
It's very important that tree nodes don't capture contexts. The @transientParam
annotation makes sure they don't.
Tree ids are now allocated in chunks. All ids in the same chunk
were produced by contexts with the same source file.
Inlined sources might not come from a compilation units that's currently compiled.
Copies should have the same source attribute as originals.
Serialize source file changes in positions section
Tree ids survive compilation runs, need to be allocated globally.
Pickle SOURCE position for roots, so that unpickler get the'right source when
constructing trees.
Generate a position entry if sourcefiles change.
nicolasstucki and others added 20 commits January 12, 2019 12:19
Used to depend on file's path, but that does not work for VirtualFiles
that might be different even though they have the same path.
Use interned strings for the comparison of their paths.
Reduce concurrent hashmap lookups in TreeIds by caching the last result in SourceInfo.
This reduces lookups for typer/*.scala from 500K+ to 7.6K.
Deemphasize AbstractFile, drop TreeIds.
When set, prints full source positions, not just file + line.
The decision when to pickle a position is a time sink. Try to optimize
this by not going through Positioned#{initialSpan,elemSource} functionality.
Single traversal to set id and span.
It's called more often now that we generation source positions. Time
for some caching.
@odersky
Copy link
Contributor Author

odersky commented Jan 12, 2019

I think we should put this on hold until #5644 is merged. The reason is merge conflicts with other inflight PR's. Such conflicts will almost certainly be build errors for #5644, since types have different names. But if we apply #5697 on top, we get the same type name Position but now with a different meaning. Not sure the build failure after rebase of this PR is related to that, but it could be.

@odersky
Copy link
Contributor Author

odersky commented Jan 15, 2019

This should be revived starting from #5713, once that one is in.

@odersky odersky closed this Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants